<?php
require_once 'phpmoko/lib/common.php';

class MySQLDataResult
{
	/**
	 *
	 * @var mysqli_result
	 */
	private $result;

	/**
	 *
	 * @var mysqli
	 */
	private $mysqli;

	function __construct($mysql, $result)
	{
		$this->mysqli = $mysql;
		$this->result = $result;
	}

	function __destruct()
	{
		if ($this->result && ($this->result !== TRUE))
			$this->result->close();
	}

	function getNumRows()
	{
		if ($this->result == null)
			return 0;

		return $this->result->num_rows;
	}

	function fetchAssoc()
	{
		if ($this->result == null)
			return false;

		return $this->result->fetch_assoc();
	}
}
?>